<?php
//sanitize.php

//**	sanitize
//@&$userInput			UserInput is passed by reference and modified throughout the function to become sql safe
//return 9				9 represents the error code of the userInput being too short
//return 1				Using the modified $userInput should only happen if a 1 is returned, exit otherwise.
function sanitize(&$userInput){

	$userInput = strip_tags($userInput);
	$userInput = mysql_real_escape_string($userInput);
	$userInput = htmlspecialchars($userInput);
	
	if(strlen($userInput) < 1)
		return 9;
		
	return 1;
}

//** If user is not authorized to view this page directly
if(!isset($authorizedPage))
	require('error.php');